#define _CRT_SECURE_NO_WARNINGS
#include <iostream>

using namespace std;
typedef long long LL;
const int MOD = 100003;
LL qpow(LL a, LL b, LL p)
{
	LL ret = 1;
	while (b)
	{
		if (b & 1) ret = ret * a % p;
		a = a * a % p;
		b >>= 1;
	}
	return ret;
}
int main()
{
	LL m, n; cin >> m >> n;
	cout << ((qpow(m, n, MOD) % MOD - (qpow(m - 1, n - 1, MOD) * m % MOD)) % MOD + MOD) %MOD << endl;
	return 0;
}